<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<meta name="viewport"
	      content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
	<meta http-equiv="X-UA-Compatible" content="ie=edge">
	<title>全国青少年电子信息智能创新大赛</title>
	<link rel="icon" href="./images/logo.png">
	<link rel="stylesheet" href="./lib/swiper/css/swiper.min.css">
	<link rel="stylesheet" href="./lib/layui/css/layui.css">
	<link rel="stylesheet" href="./css/notice-details.css">
	<link rel="stylesheet" href="./lib/layui/css/modules/layer/default/layer.css">
</head>
<body>
<section class="wrapper" v-cloak>
	<common-header active-path="notice.html"></common-header>
	<section class="content">
		<section class="breadcrumb">
			<section class="container">
				位置：  首页 > <a href="./notice.html">{{ text }}</a>> <span>{{ noticeData.title }}</span>
			</section>
		</section>
		<section class="notice-details container">
			<section class="title">
				<section class="name">{{ noticeData.title }}</section>
				<section class="time">
					<img src="./images/icons/time.png" alt=""> {{ formatTime(noticeData.createTime) }}
				</section>
			</section>
			<section class="text" v-html="noticeData.content">

			</section>
			<a class="btn" v-if="noticeData.actionType === 1" href="javascript:;" @click="join">确认参赛</a>
		</section>
	</section>
	<common-footer></common-footer>
</section>
</body>
<script src="./lib/swiper/js/swiper.min.js"></script>
<script src="./js/jquery.min.js"></script>
<script src="./lib/layui/layui.js"></script>
<script src="./lib/layui/lay/modules/layer.js"></script>
<script src="./js/vue.min.js"></script>
<script src="../js/abkj/fun_tool.js"></script>
<script src="../js/abkj/slAjax.js"></script>
<script src="../js/abkj/match/api/webinfo.js"></script>
<script src="../js/abkj/ext/signExt.js"></script>
<script src="../js/abkj/match/api/news.js"></script>
<script src="./js/common.js"></script>
<script src="../js/abkj/ext/news.js"></script>
<script src="./components/index.js"></script>
<script src="../js/abkj/ext/news.js"></script>
<script>
	$(function () {
		var tool = fun_tool()
		var vm = new Vue({
			el: '.wrapper',
			data: {
				text: tool.getUrlParam('isNotice') ? '消息中心' : '赛项说明',
				noticeData: {}
			},
			mounted: function () {
				var vm = this
				// ClientNewsGet(tool.getUrlParam('id'), function (data) {
				// 		console.log(data)
				// 		vm.noticeData = data
				// 	}, function (err) {
				// 		console.log(err)
				// 	})
				// alert(tool.getUrlParam('isNotice'))
				if(tool.getUrlParam('isNotice') ){
					ClientNewsGet(tool.getUrlParam('id'), function (data) {
						console.log(data)
						vm.noticeData = data
					}, function (err) {
						console.log(err)
					})
				}else{
					ClientNewsGet(tool.getUrlParam('id'), function (data) {
						console.log(data)
						vm.noticeData = data
					}, function (err) {
						console.log(err)
					})
				}
				layui.use('layer')

			},
			methods: {
				join: function () {
					var vm = this
					this.$confirm({
						title: '确认参赛吗？',
						success: function () {
							joinTeam(vm.noticeData.param, function () {
								layer.msg('参赛成功，您可以通过电子学会微信小程序或者登录电子学会比赛平台实时查询参赛进度。', {icon: 1})
								setTimeout(function () {
									history.back()
								}, 1500)
							}, function () {
								layer.msg('邀请已取消', {icon: 5})
							})
						}
					})
				},
				formatTime: function (time) {
					if (!time) return time
					return time.split('T')[0]
				},
			}
		})
	})
</script>
</html>
